from sympy import Symbol, sin, cos, Matrix

x=Symbol('x')
y=Symbol('y')
z=Symbol('z')

rotx=Matrix([[1,        0,      0,  0],
             [0,   cos(-x), sin(-x),  0],
             [0,  -sin(-x), cos(-x),  0],
             [0,        0,      0,   1]])

roty=Matrix([[cos(-y),  0, -sin(-y),  0],
             [0,        1,      0,  0],
             [sin(-y),  0,  cos(-y),  0],
             [0,        0,      0,   1]])

rotz=Matrix([[cos(-z),    sin(-z), 0, 0],
             [-sin(-z),   cos(-z), 0, 0],
             [0     ,         0, 1, 0],
             [0     ,         0, 0, 1]])

R = rotz*roty*rotx
